<?php
declare(strict_types=1);

namespace app\admin\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class User extends Model
{
    public function search()
    {
        // 取出主键为1的数据
        $result = $this->find(1);
        return $result;
    }
    
    //添加数据
    public function addData($data)
    {
        $result=$this->save($data);
        return $result;
    }
    
    //获取器
    public function getGradeAttr($value)
    {
        $status = [1=>'等级一',2=>'等级二',3=>'等级三'];
        return $status[$value];
    }
    //修改器
    public function setSexAttr($value)
    {
        $status = ['female'=>'女士','male'=>'男士'];
        return $status[$value];
    }
}
